<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<fmt:setBundle basename="Messages_en" />
<title><fmt:message key="title.reviewbooking"/></title>
</head>
<body>
<%@ include file="header.jsp" %>
<table>
<tr>
<td width=12%></td>
<td class="menuborder" width=16%>
<table id="head">
			<tr>
<!-- 				<td><h2 id="header">ISS Facilities Booking</h2></td> -->
				<td>
<!-- 				<input type="hidden" name="welcome" id="show_greeting" /> -->
				<c:if test="${!empty sessionScope.LoggedinUser.username}">
				<h5>Welcome ${sessionScope.LoggedinUser.username}</h5>
				</c:if>
				</td>
			</tr>
		</table>
		<table id="content">
			<tr>
				<td><h2 id="header">MENU</h2></td>
			</tr>
			<tr>
				<td><a href="MakeABooking.jsp">Make a Booking</a></td>
			</tr>
			<tr>
				<td><a href="BookDetailsController">View Booking Details</a></td>
			</tr>
			<tr>
				<td><a href="BookingHistoryController">View Booking History</a></td>
			</tr>
			<tr>
				<td><a href="ReviewController">Review Booking</a></td>
			</tr>
			<tr>
				<td><a href="Login.jsp">Sign Out</a>
				</td>
			</tr>
		</table>
</td>
<td width=2%></td>
<td class="contentbody" width=60%>
<c:if test="${fn:length(bookdetails) > 0}">
	<table border="1">
		<thead>
			<tr>
				<th><fmt:message key="label.Booking.bookId"/></th>
				<th><fmt:message key="label.Booking.bookedby"/></th>
				<th><fmt:message key="label.Booking.priority"/></th>
				<th><fmt:message key="label.Booking.facilityname"/></th>
				<th><fmt:message key="label.Booking.fromDate"/></th>
				<th><fmt:message key="label.Booking.toDate"/></th>
				<th><fmt:message key="label.Booking.emergency"/></th>
				<th><fmt:message key="label.Booking.reason"/></th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="booking" items="${bookdetails}" varStatus="loop">
				<c:if test="${booking.emergency=='N'}">
					<tr>
				</c:if>
				<c:if test="${booking.emergency=='Y'}">
					<tr style="background-color:#FFFF00">
				</c:if>
					<td>
						<form method="get" action="<c:url value='/ApproveController'/>">
							<input type="hidden" name="book" value="${booking.bookingID}">
							<input type="submit" value="${booking.bookingID}">
						</form>
					</td>
					<td><c:out value="${users[loop.index].username}" /></td>
					<td><c:out value="${booking.priority}" /></td>
					<td><c:out value="${booking.facilityName}" /></td>
					<td><c:out value="${booking.fromDate}" /></td>
					<td><c:out value="${booking.toDate}" /></td>
					<td><c:out value="${booking.emergency}" /></td>
					<td><c:out value="${booking.reason}" /></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</c:if>
<c:if test="${fn:length(bookdetails) == 0}">
	<h2>Nothing to approve!</h2>
</c:if>
</td>
<td width=10%></td>
</tr>
</table>
<%@ include file="footer.jsp" %>
</body>
</html>